package tests.fakes;

import jeconbond.economic.agent.IEconomicProducer;
import jeconbond.economic.resources.IResourceType;
import jeconbond.economic.resources.ResourceStorrage;
import jeconbond.economic.systems.natural.NaturalResourceRedestributionSystem;
import jeconbond.economic.strategy.IMerchant;

public class TamagoochiAgent implements IEconomicProducer {
	private IResourceType foodType;
	private IResourceType excrementType;
	private NaturalResourceRedestributionSystem nrrs;
	
	public TamagoochiAgent(
			IResourceType foodType, 
			IResourceType excrementType,
			NaturalResourceRedestributionSystem nrrs
			) {
		this.foodType = foodType;
		this.excrementType = excrementType;
		this.nrrs = nrrs;
	}

	@Override
	public void setMerchant(IMerchant merchant) {
	}

	@Override
	public ResourceStorrage getInputRS() {
		return null;
	}

	@Override
	public ResourceStorrage getOutputRS() {
		return null;
	}

	@Override
	public void processPreProduceStage() {
		double foodVal = nrrs.receiveResource(foodType, 1.0);
		if (foodVal < 1.0) {
			throw new RuntimeException("Tamagoochi dead !!!");
		}
	}
	
	@Override
	public void processPostProduceStage() {
		nrrs.storeResource(excrementType, 100.0);
	}
	
	@Override
	public void processProduceStage() {
	}

	@Override
	public IMerchant getMerchant() {
		return null;
	}
}
